
// <copyright file="HttpListenerWrapper.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   The http listener wrapper.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Net
{
    using System;
    using System.Net;

    /// <summary>
    /// The http listener wrapper.
    /// </summary>
    public class HttpListenerWrapper : AbstractHttpListenerWrapper
    {
        #region Public Events

        /// <summary>
        /// The on request received.
        /// </summary>
        public event EventHandler<HttpRequestReceivedEventArgs> OnRequestReceived;

        #endregion Public Events

        #region Methods

        /// <summary>
        /// The process request.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void processRequest(HttpListenerContext context)
        {
            if (this.OnRequestReceived != null)
            {
                this.OnRequestReceived(this, new HttpRequestReceivedEventArgs(context));
            }
        }

        #endregion Methods
    }

    /// <summary>
    /// The http request received event args.
    /// </summary>
    public class HttpRequestReceivedEventArgs : EventArgs
    {
        #region Constructors and Finalizers

        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRequestReceivedEventArgs"/> class.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        public HttpRequestReceivedEventArgs(HttpListenerContext context)
        {
            this.Context = context;
        }

        #endregion Constructors and Finalizers

        #region Public Properties

        /// <summary>
        /// Gets the context.
        /// </summary>
        public HttpListenerContext Context { get; private set; }

        #endregion Public Properties
    }
}
